<!DOCTYPE html>
<!--suppress ALL-->
<html xmlns:th="http://www.thymeleaf.org">

<head>
    <meta charset="UTF-8">
    <title>欢迎页面-X-admin2.0</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <link rel="stylesheet" th:href="@{/css/font.css}">
    <link rel="stylesheet" th:href="@{/css/xadmin.css}">
    <script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
    <script type="text/javascript" th:src="@{/lib/layui/layui.js}" charset="utf-8"></script>
    <script type="text/javascript" th:src="@{/js/xadmin.js}"></script>
    <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
    <!--[if lt IE 9]>
    <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
    <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>

<body>
<div class="x-nav">
      <span class="layui-breadcrumb">
        <a href="">首页</a>
        <a>
          <cite>角色管理</cite></a>
      </span>
    <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" href="javascript:location.replace(location.href);" title="刷新">
        <i class="layui-icon" style="line-height:30px">ဂ</i></a>
</div>
<div class="x-body">
    <div class="layui-row">
        <button class="layui-btn layui-btn-normal" onclick="funAdd('新增权限')" >添加权限</button>
    </div>
    <xblock>
        <span class="x-right" style="line-height:40px">共有数据：[[${funSum}]] 条</span>
    </xblock>
    <table class="layui-table">
        <thead>
        <tr>
            <th>ID</th>
            <th>权限名</th>
            <th>权限url</th>
            <th>权限等级</th>
            <th>操作</th>
        </thead>
        <tbody>
        <tr th:each="fun:${limitFun}">
            <td th:text="${fun.getFunctionId()}"></td>
            <td th:text="${fun.getFunctionName()}"></td>
            <td th:text="${fun.getFunctionUrl()}"></td>
            <td th:text="${fun.getFunctionPid()}"></td>
            <td class="td-manage" style="width: 500px">
                <button type="button" class="layui-btn layui-btn-radius layui-btn-danger" th:value="${fun.getFunctionId()}"  onclick="fundel(this)">删除权限</button>
            </td>
        </tr>
        </tbody>
    </table>
    <div class="page">
        <div>
            <a class="prev" onclick="funType('up')" style="cursor:pointer;">&lt;&lt;上一页</a>
            <!--th:if="${roleList.size()>=5}"-->
            <a class="next" onclick="roleType('wn')" style="cursor:pointer;" th:if="${limitFun.size()>=5}">&gt;&gt;下一页</a>
        </div>
    </div>

</div>
<script>
    /*权限-删除*/
    function fundel(obj){
        var funid = $(obj).val();
        console.log(funid);
        layer.confirm('确认要删除吗？ '+funid,function(index){
            console.log(index);
            //发异步删除数据
            $.get("fundel?funid="+funid,function (item) {
                layer.msg(item.message,{icon:1,time:1000});
            })
        });
    }
    function funAdd(title){
        utilFun(title,"funAdd");
    }

    function utilFun(title,url){

        if (title == null || title == '') {
            title=false;
        };
        layer.open({
            type: 2,
            area: [510+'px', 370 +'px'],
            fix: false, //不固定
            maxmin: true,
            shadeClose: true,
            shade:0.4,
            title: title,
            content: url
        });
    }

    function funType(type){
        window.location.href="function?type="+type;
    }


</script>
<script>var _hmt = _hmt || []; (function() {
    var hm = document.createElement("script");
    hm.src = "https://hm.baidu.com/hm.js?b393d153aeb26b46e9431fabaf0f6190";
    var s = document.getElementsByTagName("script")[0];
    s.parentNode.insertBefore(hm, s);
})();</script>
</body>

</html>